home *** CD-ROM | disk | FTP | other *** search
/ Champak 123 / (Vol 123) Jan 13 2011.iso / Games / island_fishing.swf / scripts / DefineSprite_152 / frame_1 / DoAction.as
Text File  |  2011-01-13  |  774b  |  41 lines

  1. stop();
  2. flashing = 0;
  3. acceleration = 10;
  4. newpos = function()
  5. {
  6.    ranx = Math.round(Math.random() * 550);
  7.    rany = Math.round(Math.random() * 400);
  8. };
  9. newpos();
  10. this.onEnterFrame = function()
  11. {
  12.    if(hooked <= 0)
  13.    {
  14.       if(ranx > this._x)
  15.       {
  16.          this._xscale = -100;
  17.       }
  18.       if(ranx < this._x)
  19.       {
  20.          this._xscale = 100;
  21.       }
  22.       this._x += (ranx - this._x) / acceleration;
  23.       if(this._y > 190)
  24.       {
  25.          this._y += (rany - this._y) / acceleration;
  26.          if(rany <= 175)
  27.          {
  28.             newpos();
  29.          }
  30.       }
  31.       else
  32.       {
  33.          this._y += 1;
  34.       }
  35.       if(Math.round(this._x) == ranx || Math.round(this._y) == rany)
  36.       {
  37.          newpos();
  38.       }
  39.    }
  40. };
  41.